<template>
  <div>
    <Card >
      <div :class=" $app.judgeData(userPower)?' ' :' visHidden ' ">
        <div  style="margin-top:20px;margin-bottom:50px;">
          <div 
            class=" pullLeft marginR30"
            :class="($app.judgeData(companyAll) && companyAll.state==2)?' pointer':' '"
          >
            <Avatar :src="$store.state.F_cat.userImg"  shape="square" class="tX  " />
          </div>
          <div class="overflowH">
            <div style="margin-bottom:10px; margin-top:5px;">
              <span class="marginR30 f_18 f_bold c333">ID：{{userPower.mobile}}</span>
              <span class="marginR30 f_18  c333">注册时间：{{userPower.created_date}}</span>
            </div>
            <div>
              <div class="xwBle">
                <span>所属公司：{{$app.judgeData(companyAll.company_name)?companyAll.company_name:'未认证'}}</span>
                <Divider type="vertical" class="fenXw"/>

                <template v-if="userPower.is_admin">
                  
                  <span v-show="userPower.partner_id>0">角色：管理员</span>
                  <span v-show="userPower.partner_id==0">角色：新用户</span>
                </template>
                <template v-else>
                  <span>角色：{{$app.judgeData(userPower.name)?userPower.name:''}}</span>
                  <Divider type="vertical" class="fenXw"/>
                  <span>昵称：{{$app.judgeData(userPower.role_name)?userPower.role_name:'未认证'}}</span>
                </template>
                
              </div>
            </div>
            <div class="f_16 marginB10"></div>
            <div class="f_16 marginB10"></div>
            <div class="f_16 marginB10 "></div>
          </div>
          <div class="clearBoth"></div>
        </div>

        <div style="width:1000px">
          <Row>
            <Col :span="10">登录密码</Col>
            <Col :span="8">
              <span v-show="$app.judgeData(userPower.has_password)" >已设置</span>
              <span v-show="!$app.judgeData(userPower.has_password)" class="cCCC">未设置</span>
            </Col>
            <Col :span="6" class="textRight">
              <span class="textLine cBlue" @click="xG_password">修 改</span>
            </Col>
          </Row>
          <Divider ></Divider>
          <Row>
            <Col :span="10">个人邮箱</Col>
            <Col :span="8">
              <span v-show="$app.judgeData(userPower.email)" >{{userPower.email}}</span>
              <span v-show="!$app.judgeData(userPower.email)" class="cCCC">未设置</span>
            </Col>
            <Col :span="6" class="textRight">
              <span class="textLine cBlue" @click="xG_emailword">
                {{$app.judgeData(userPower.email)?'修 改':'绑 定'}}
              </span>
            </Col>
          </Row>
          <Divider ></Divider>
          <Row>
            <Col :span="10">手机验证</Col>
            <Col :span="8">{{userPower.mobile}}</Col>
            <Col :span="6"class="textRight">
              <!-- <span class="cCCC">暂不支持修改</span> -->
            </Col>
          </Row>
          <Divider ></Divider>

          <Row>
            <Col :span="10">微信登录</Col>
            <Col :span="8">
              <span v-show="$app.judgeData(userPower.is_bind_wx)" >已绑定</span>
              <span v-show="!$app.judgeData(userPower.is_bind_wx)" class="cCCC">未绑定</span>
            </Col>
            <Col :span="6" class="textRight">
              <span class="textLine cBlue" v-show="!$app.judgeData(userPower.is_bind_wx)" @click="is_bind_wx_Go">绑 定</span>
            </Col>
          </Row>
          <Divider ></Divider>

          <!-- <Row>
            <Col :span="10">微信绑定</Col>
            <Col :span="8">{{userPower.mobile}}</Col>
            <Col :span="6"class="textRight">
              <span class="textLine cBlue" @click="xG_emailword">
                {{$app.judgeData(userPower.email)?'正在处理当中yes':'绑 定'}}
              </span>
            </Col>
          </Row>
          <Divider ></Divider> -->
        </div>
        
        <ZhAnQ ref="ZhAnQ" style="margin:20px 0 50px 0;"/>

      </div>
      
    </Card>

    <PosswordSet ref="posswordSet" :userPower="userPower" :companyAl="companyAll" @getData="getData" />
    <EmailSet ref="emailSet" :userPower="userPower" :companyAl="companyAll" @getData="getData"  />
    
  </div>
</template>

<style lang="less" scoped>
  @import './_service/css/userSmall.less';
</style>

<script>
import PosswordSet from "./_service/posswordSet";
import EmailSet from "./_service/emailSet";
import ZhAnQ from "@$@/_service/zhAnQ";
export default {
  name: 'personInfo',
  components: {PosswordSet,EmailSet,ZhAnQ},
  data () {
    let data={
      userPower:'',
      companyAll:''
    }
    let tool={
    };
    return Object.assign(data, tool);
  },
  created(){
    $app.loading();
    this.getData();
  },
  mounted () {

  },
  methods: {
    getData(){
      // 获取用户信息
      $ajax.userInfo(resData=>{
        this.userPower=resData;
      });
      //获取企业信息
      $ajax.pInfo(resData => {
        this.companyAll=resData;
      });
    },
    xG_password(){
      this.$refs['posswordSet'].posswordSet=true;//显示弹框
    },
    xG_emailword () {
      this.$refs['emailSet'].showBox=true;//显示弹框
    },

    // 绑定 微信扫码登录
    is_bind_wx_Go(){
      $ajax.wechat_qrCodeLogin(({url})=>{
        //设置本地存储
        $app.setLocal (window.location.href, 'bind_wx_init_url');
        
        // 跳去登录页
        window.location = url;
      });
    },
  }
}
</script>

